package com.example.mywechat;


import androidx.fragment.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class addressFragment extends Fragment {
    private RecyclerView recyclerView;
    private List<String> myList=new ArrayList<>();
    private Context context;
    private address_adapter adapter;

    public addressFragment() {
        // Required empty public constructor
    }

    private void initData(){
        myList.add("GNZ");
        myList.add("JYC");
        myList.add("TYR");
        myList.add("XSW");
        myList.add("HQY");
        myList.add("WHYF");
    }

    private void initView3() {
        context=this.getActivity();
        address_adapter adapter = new address_adapter(context);

        RecyclerView rcv_3 = recyclerView.findViewById(R.id.item3);

        LinearLayoutManager manager_3 = new LinearLayoutManager(context);
        manager_3.setOrientation(LinearLayoutManager.HORIZONTAL);


        rcv_3.setLayoutManager(manager_3);
        rcv_3.setHasFixedSize(true);
        rcv_3.setAdapter(adapter);

        adapter.setVerticalDataList(myList);
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.tab03, container, false);
        recyclerView=view.findViewById(R.id.item3);
        initData();
        initView3();
        return view;
    }

}
